/**
 * @filename:StockServiceImpl 2023-4-19
 * @project Wonder Java前后台分离框架  1.1.0
 * Copyright(c) 2022 Wonder Co. Ltd. 
 * All right reserved. 
 */
package com.wonder.app.service.impl;

import com.wonder.app.domain.Stock;
import com.wonder.app.mapper.StockDao;
import com.wonder.app.service.StockService;
import com.wonder.app.request.StockRequest;
import com.wonder.common.utils.StringUtils;
import com.wonder.common.utils.MessageUtils;
import com.wonder.common.common.AjaxResult;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**   
 * @Description:TODO(股票管理服务实现)
 *
 * @version: 1.1.0
 * @author: Wonder
 * 
 */
@Service
public class StockServiceImpl  extends ServiceImpl<StockDao, Stock> implements StockService  {

    /**
     * 验证股票管理信息
     * 
     * @param stock
     * @param type
     * @return String
     */
    @Override
    public String validate(Stock stock,String type){
    
    
       return "";
    }
    
    
    /**
	 * Description:股票管理分页返回
	 * @param request //检索条件
	 * @param page //分页参数
	 * @return IPage<Stock>   //分页记录
	 */
	@Override 
	public IPage<Stock> selectList(StockRequest request, Page<Stock> page){
	    LambdaQueryWrapper<Stock> lambdaQueryWrapper = new LambdaQueryWrapper<>();
	    
	    if (null != request.getId()) {
	       lambdaQueryWrapper.eq(Stock::getId, request.getId());
	      }               
             
        if (StringUtils.hasText(request.getCode())) {
			    lambdaQueryWrapper.like(Stock::getCode, request.getCode()); 
		    } 
             
        if (StringUtils.hasText(request.getName())) {
			    lambdaQueryWrapper.like(Stock::getName, request.getName()); 
		    } 
             
        if (StringUtils.hasText(request.getPinyin())) {
			    lambdaQueryWrapper.like(Stock::getPinyin, request.getPinyin()); 
		    } 
             
	    if (null != request.getStop()) {
	       lambdaQueryWrapper.eq(Stock::getStop, request.getStop());
	      }               
             
	    if (null != request.getClose()) {
	       lambdaQueryWrapper.eq(Stock::getClose, request.getClose());
	      }               
             
	    if (null != request.getStatus()) {
	       lambdaQueryWrapper.eq(Stock::getStatus, request.getStatus());
	      }               
             
	    if (null != request.getTrade()) {
	       lambdaQueryWrapper.eq(Stock::getTrade, request.getTrade());
	      }               
             
        
		lambdaQueryWrapper.orderByDesc(Stock::getId);	
		Page<Stock> selectPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);
		return selectPage;
    }
        
    
	
}